﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace Bonobo.Reader.UI
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            var providers = BonoboItemProviderLoader.GetInstance().Providers;

            foreach (var provider in providers)
            {
                foreach (var c in provider.MenuCommands)
                {
                    menuProviders.Items.Add(new MenuItem()
                    {
                        ToolTip = c.ToolTip,
                        Header = c.Text,
                        CommandParameter = c,
                        Command = BonoboCommands.MenuCommand
                    });
                }
            }
        }

        private void HelpExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            MessageBox.Show("Bonobo Reader version 0.0.0.1");
        }

        private void CloseExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void RefreshExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            //var filter = new BonoboItemFilter(0, false, 10, new List<string>() { "Microsoft Feeds" });
            lvItems.ItemsSource = new BonoboItemCollection();
        }

        private void MenuCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            ((BonoboMenuCommand)e.Parameter).Executed(sender, e);
        }
    }
}
